package com.trhui.mallbook.client;

import com.trhui.mallbook.domain.common.ApiRequest;
import com.trhui.mallbook.domain.common.BaseResponse;
import com.trhui.mallbook.domain.request.QueryBalanceRequest;
import com.trhui.mallbook.domain.request.hf.HfQueryBalanceRequest;
import com.trhui.mallbook.domain.response.QueryBalanceResponse;
import com.trhui.mallbook.domain.response.hf.HfQueryBalanceResponse;
import com.trhui.mallbook.enums.ChannelTypeEnum;
import com.trhui.mallbook.enums.ServerCodeEnum;

/**
 * 账户资金查询接口
 *
 * @author linqy
 */
public class BalanceQueryClient extends AbstractClient {

    /**
     * 汇付账户资金查询接口
     *
     * @param request
     * @return
     */
    @Deprecated
    public static BaseResponse<HfQueryBalanceResponse> hfQueryBalance(HfQueryBalanceRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_BALANCE)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(apiRequest, HfQueryBalanceResponse.class);
    }

    /**
     * 账户资金查询接口
     *
     * @param request
     * @return
     */
    public static BaseResponse<QueryBalanceResponse> queryBalance(QueryBalanceRequest request, ChannelTypeEnum channelTypeEnum) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_BALANCE)
                .channelType(channelTypeEnum)
                .build();
        return post(apiRequest, QueryBalanceResponse.class);
    }


}
